package com.demo.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;


public class Test2 {

    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        String url= "jdbc:mysql://106.13.7.203:3306/wg12?useCursorFetch=true&amp;autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF-8";
        String username = "root";
        String password = "Asd6250390@";
        Class.forName("com.mysql.jdbc.Driver");
        Connection conn = DriverManager.getConnection(url, username, password);
        System.out.println("连接成功");
        String sql = "update users set gender='男' where id=6";
        PreparedStatement ps = conn.prepareStatement(sql);
        ps.execute();
        System.out.println("执行完毕");
    }
}
